---
layout: example
categories: example/v1.0.0
version: v1.0.0
title: GeoJSON from live realtime data
description: Use realtime GeoJSON data streams to move markers on your map with Mapbox.js.
tags:
  - markers
---

<div id='map'></div>
<script>
var map = L.mapbox.map('map')
    .setView([38, -102.0], 2)
    .addLayer(L.mapbox.styleLayer('mapbox://styles/mapbox/streets-v11'));

// As with any other AJAX request, this technique is subject to the Same Origin Policy:
// http://en.wikipedia.org/wiki/Same_origin_policy
var featureLayer = L.mapbox.featureLayer()
    .loadURL('https://wanderdrone.appspot.com/')
    // Once this layer loads, we set a timer to load it again in a few seconds.
    .on('ready', run)
    .addTo(map);

function run() {
    featureLayer.eachLayer(function(l) {
        map.panTo(l.getLatLng());
    });
    window.setTimeout(function() {
        featureLayer.loadURL('https://wanderdrone.appspot.com/');
    }, 2000);
}
</script>
